import Vue from 'vue'
import Router from 'vue-router'

import Layout from '@/views/layout/index'

Vue.use(Router)

export const constantRouterMap = [
  {
    path: 'login',
    name: 'login',
    component: () => import('@/views/login/index')
  },
  {
    path: '',
    redirect: '/home',
    component: Layout,
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/home/index')
      }
    ]
  },
  {
    path: '/oms',
    redirect: '/order-list',
    component: Layout,
    children: [
      {
        path: 'order-list',
        name: 'order-list',
        component: () => import('@/views/oms/order-list')
      }
    ]
  }
]

export default new Router({
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})
